package com.itheima.ms.tl;

import com.itheima.ms.enums.DBRoleEnum;

/**
 * 用于设置key到当前线程，为spring提供指引
 */
public class DataSourceTypeTL {

    private final static ThreadLocal<DBRoleEnum> dbRole = new ThreadLocal<>();

    public static void setDbRole(DBRoleEnum dbRoleValue) {
        dbRole.set(dbRoleValue);
    }

    public static DBRoleEnum getDbRole() {
        return dbRole.get();
    }

    public static void clearDbRole(){
        dbRole.remove();
    }
}
